<template>
  <nav class="nav-bar">
    <router-link 
      v-for="item in navItems" 
      :key="item.path"
      :to="item.path"
      class="nav-item"
      :class="{ active: currentPath === item.path }"
    >
      <i :class="item.icon"></i>
      <span>{{ item.text }}</span>
    </router-link>
  </nav>
</template>

<script setup>
import { ref, computed } from 'vue'
import { useRoute } from 'vue-router'

const route = useRoute()
const currentPath = computed(() => route.path)

const navItems = ref([
  { path: '/', text: '首页', icon: 'icon-home' },
  { path: '/shop', text: '宠物商店', icon: 'icon-shop' },
  { path: '/pet-swipe', text: '刷宠物', icon: 'icon-swipe' },
  { path: '/message', text: '消息', icon: 'icon-message' },
  { path: '/profile', text: '我的', icon: 'icon-profile' }
])
</script>

<style scoped>
.nav-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  display: flex;
  background: var(--color-white);
  border-top: 1px solid #eee;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--color-gray);
  text-decoration: none;
}

.nav-item.active {
  color: var(--color-accent);
}

.nav-item i {
  font-size: 24px;
  margin-bottom: 4px;
}

.nav-item span {
  font-size: 12px;
}
</style> 